package com.jeeplus.modules.guide.service;

import com.jeeplus.database.datasource.annotation.DS;
import com.jeeplus.modules.guide.mapper.QueueDetailMapper;
import com.jeeplus.modules.guide.model.domain.QueueInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName: QueueService
 * Function:  当前排队信息
 * Date:      2021/6/11 18:38
 *
 * @author hanKongbin
 * version    V1.0
 */
@DS("queuing")
@RequiredArgsConstructor
@Service
@Slf4j
public class CurrentQueueService {

    private final QueueDetailMapper queueDetailMapper;

    /**
     * 当前排队信息
     *
     * @param busId
     * @param offices
     * @return
     */
    public QueueInfo getCurrentQueue(String busId, String offices) {
        try {
            return queueDetailMapper.queryWaitCountByBusiness(busId, offices);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("获取业务当前等待人数失败，业务id->{}", busId);
        }
        return new QueueInfo();
    }
}
